import request from '@/utils/request'

// 查询报销列表
export function listExpense(query) {
  return request({
    url: '/workflow/expense/page',
    method: 'get',
    params: query
  })
}

// 查询报销详情
export function getExpense(id) {
  return request({
    url: '/workflow/expense/' + id,
    method: 'get'
  })
}

// 新增报销
export function addExpense(data) {
  return request({
    url: '/workflow/expense',
    method: 'post',
    data: data
  })
}

// 修改报销
export function updateExpense(data) {
  return request({
    url: '/workflow/expense',
    method: 'put',
    data: data
  })
}

// 提交报销
export function submitExpense(id) {
  return request({
    url: '/workflow/expense/submit/' + id,
    method: 'post'
  })
}

// 取消报销
export function cancelExpense(id) {
  return request({
    url: '/workflow/expense/cancel/' + id,
    method: 'post'
  })
}

// 支付报销
export function payExpense(id) {
  return request({
    url: '/workflow/expense/pay/' + id,
    method: 'post'
  })
}

// 上传附件
export function uploadExpenseAttachment(data) {
  return request({
    url: '/workflow/expense/upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 获取我的报销列表
export function getMyExpenses(query) {
  return request({
    url: '/workflow/expense/my',
    method: 'get',
    params: query
  })
} 